Skip to content

Stamp delta bundles with base commit SHA and exclude stale artifact DBs#27

Open
joshfriend wants to merge 1 commit into
mainfrom
jfriend/delta-base-commit-stamping
Open

Stamp delta bundles with base commit SHA and exclude stale artifact DBs#27
joshfriend wants to merge 1 commit into
mainfrom
jfriend/delta-base-commit-stamping

Conversation

@joshfriend
Copy link
Copy Markdown
Collaborator

@joshfriend joshfriend commented May 2, 2026

Delta base-commit stamping

Prevents cross-base contamination by embedding the base commit SHA in delta bundles.

Save path: SaveDelta reads .cache-base-commit from GRADLE_USER_HOME and stamps the delta with the base SHA in two places:

  • S3 user-metadata (x-amz-meta-base-commit) for cheap pre-download check via HEAD
  • Synthetic __base_commit__ tar entry as first archive entry (fallback for non-S3 backends)

Restore path: Restore writes hitCommit to .cache-base-commit after base extraction. The delta pre-fetch goroutine checks metadata before downloading and tar stamp after downloading. Mismatches skip the delta entirely.

Standalone RestoreDelta: checks metadata against the local .cache-base-commit file.

Extraction: processEntry skips the synthetic __base_commit__ entry so it never hits the filesystem.

Delta exclusions

Adds module-artifact.bin and resource-at-url.bin to DeltaExclusions. Both are Gradle embedded BTree databases rewritten every build due to compaction. A stale module-artifact.bin from one resolution applied on top of a base from a different resolution causes Gradle to skip downloading jars it thinks are cached, then fail with File/directory does not exist.

Integration test

Adds TestIntegrationDeltaConfigurationCacheStaleArtifactPath reproducing the advancing-base scenario where a delta from Base A applied to Base C causes stale configuration-cache paths.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f71dfb01af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread gradlecache/save.go Outdated
@joshfriend joshfriend force-pushed the jfriend/delta-base-commit-stamping branch 3 times, most recently from 0dcf412 to 139f811 Compare May 2, 2026 12:36
@joshfriend joshfriend changed the title Fix cross-base delta contamination with base commit stamping Exclude module-artifact.bin and resource-at-url.bin from delta bundles May 2, 2026
@joshfriend joshfriend force-pushed the jfriend/delta-base-commit-stamping branch from 139f811 to 91ed146 Compare May 20, 2026 22:19
@joshfriend joshfriend changed the title Exclude module-artifact.bin and resource-at-url.bin from delta bundles Stamp delta bundles with base commit SHA and exclude stale artifact DBs May 20, 2026
@joshfriend joshfriend force-pushed the jfriend/delta-base-commit-stamping branch 8 times, most recently from 8ce44ad to df1c98a Compare May 21, 2026 15:14
Embed the base commit SHA in delta bundles to prevent cross-base
contamination. On restore, write the hit commit to .cache-base-commit.
SaveDelta reads it and stamps the delta via S3 metadata and a synthetic
__base_commit__ tar entry. Restore checks both before applying.

Also exclude module-artifact.bin and resource-at-url.bin from deltas
to prevent stale resolution metadata from causing missing-jar failures.
@joshfriend joshfriend force-pushed the jfriend/delta-base-commit-stamping branch from df1c98a to fe0d968 Compare May 21, 2026 20:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant